﻿using System;
using System.Collections.Generic;
using Caliburn.Micro;

namespace OsmerFvg.ViewModels
{
    public class WebCamsViewModel : Screen
    {

        public class WebCam
        {
            public string WebCamName { get; set; }
            public Uri WebCamUri { get; set; }

            public override string ToString()
            {
                return WebCamName;
            }
        }

        private readonly INavigationService _navigationService;

        public WebCamsViewModel(INavigationService navigationService)
        {
            _navigationService = navigationService;
            LoadWebCams();
        }

        public List<WebCam> WebCamsList { get; set; }
        private WebCam _selectedWebCam;
        public WebCam SelectedWebCam
        {
            get { return _selectedWebCam; }
            set
            {
                _selectedWebCam = value;
                NotifyOfPropertyChange(() => SelectedWebCam);
            }
        }

        public void ZoomWebCamCommand()
        {
            _navigationService.UriFor<WebCamsZoomViewModel>()
                .WithParam(x => x.PageHeaderText, SelectedWebCam.WebCamName)
                .WithParam(x => x.ImageSourceUri, SelectedWebCam.WebCamUri)
                .Navigate();
        }



        private void LoadWebCams()
        {
            WebCamsList = new List<WebCam>();
            WebCamsList.Add(new WebCam { WebCamName = "Aurisina", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamAurisina.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Barcis", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamBarcis.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Cave Del Predil", WebCamUri = new Uri("http://raibl.qnet.it/MOBOTIX/esterno.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Cimolais", WebCamUri = new Uri("http://www.parcodolomitifriulane.it/PN05/current.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Claut", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamClaut.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "FaakerSee", WebCamUri = new Uri("http://faakersee.it-wms.com/big_panorama1.jpg?1359760671415", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Fontanafredda", WebCamUri = new Uri("http://fontanafredda.altervista.org/_altervista_ht/current.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Forni Di Sopra", WebCamUri = new Uri("http://promotur.digitalwebland.com/webcam/crusicalas.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Gemona", WebCamUri = new Uri("http://meteogemona.dnsalias.com/record/current.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Gorizia", WebCamUri = new Uri("http://2.234.106.144/record/current.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Grado", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamGradoMare.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Kotschach-Mauthen", WebCamUri = new Uri("http://www.koemau.at/webcam/upload/big_current1.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Lignano", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamLignano.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Ligosullo", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamLigosullo.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Monfalcone", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamMonfalcone.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Monte Acomizza", WebCamUri = new Uri("http://www.crs.inogs.it/ipcam/acom/acom.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Monte Lussari", WebCamUri = new Uri("http://promotur.digitalwebland.com/webcam/lussari_tn.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Monte Zoncolan", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamZoncolan.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Muggia", WebCamUri = new Uri("http://www.snpullino.it/ipcamera/webmuggianord.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Nassfeld", WebCamUri = new Uri("http://nassfeld1.it-wms.com/panorama2.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Resia", WebCamUri = new Uri("http://82.106.181.26/record/current.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Sappada", WebCamUri = new Uri("http://www.arpa.veneto.it/csvdi/svm/arpav/arp008.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Sauris Di Sopra", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamSauris.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Tarcento", WebCamUri = new Uri("http://79.38.107.56/record/current.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Tolmezzo", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamTolmezzo.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Trieste", WebCamUri = new Uri("http://www.meteo.fvg.it/COMMON/WEBCAM/WebcamTrieste.jpg", UriKind.Absolute) });
            WebCamsList.Add(new WebCam { WebCamName = "Udine", WebCamUri = new Uri("http://www.comune.udine.it/opencms/castello/castello.jpg", UriKind.Absolute) });
            NotifyOfPropertyChange(() => WebCamsList);
        }



    }
}
